import {getFileAccessHttpUrl,getAction} from '@/api/manage'
import { Base64 } from 'js-base64'
import store from '@/store'
import request from '@/utils/request'

export function FilePreview(filePath){
      let fileList=filePath.split(",");
      console.log(fileList,filePath,"预览文件")
      if(fileList && fileList.length>0){
        fileList.forEach(element => {
          let reviewUrl = getFileAccessHttpUrl(element)
          let rowpath = reviewUrl.replace(/\\/g, '/')
          let base = window._CONFIG.onlinePreviewDomainURL + '/onlinePreview?url='
          //kkfile v3以上需要base64加密 目前搭的v2.2.1
          let codename = Base64.encode(rowpath)
          let url = base + codename
          // let url  = base +rowpath
          console.log("aaaaaaaaaaa",url)
            window.open(url,'预览'+rowpath,'width=1000','height=500', '_parent');
        });
      }

}

export function GetExpandDictItem(code){
  let param={code:code};
  let url="/sysdicexpend/sysDicExpend/queryByCode"
  return request({
    url: url,
    method: 'get',
    params: param
  })
}